package com.yunjie.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * NewsInfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "news_info", catalog = "new_manage")
public class NewsInfo implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 2973099192275115913L;
	private Integer id;
	private UserInfo userInfo;
	private Categroy categroy;
	private String title;
	private String content;

	// Constructors

	/** default constructor */
	public NewsInfo() {
	}

	/** minimal constructor */
	public NewsInfo(String title, String content) {
		this.title = title;
		this.content = content;
	}

	/** full constructor */
	public NewsInfo(UserInfo userInfo, Categroy categroy, String title,
			String content) {
		this.userInfo = userInfo;
		this.categroy = categroy;
		this.title = title;
		this.content = content;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "user_id")
	public UserInfo getUserInfo() {
		return this.userInfo;
	}

	public void setUserInfo(UserInfo userInfo) {
		this.userInfo = userInfo;
	}

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "cate_id")
	public Categroy getCategroy() {
		return this.categroy;
	}

	public void setCategroy(Categroy categroy) {
		this.categroy = categroy;
	}

	@Column(name = "title", nullable = false, length = 50)
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "content", nullable = false, length = 65535)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

}